// 引入mongoose模块
const mongoose = require("mongoose");
const moment = require("moment-timezone");
// 创建求购商品留言集合规则
const wannaBuyCommentsSchema = new mongoose.Schema({
    // 修改时间
    modify: {
        type: String,
        default: moment().tz("Asia/Shanghai").format("YYYY/MM/DD HH:mm:ss"),
    },
    // 求购商品的id
    qid: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "wannaBuy",
        required: [true, 求购商品的id不能为空],
    },
    // 留言内容
    content: {
        type: String,
        required: [true, 留言内容不能为空],
    },
    // 是否可见
    display: {
        type: Boolean,
        required: [true, 是否可见不能为空],
    },
    // 评论的用户id
    uid: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "user",
        required: [true, 评论的用户id不能为空],
    },
});
// 创建求购商品留言集合
const wannaBuyComments = mongoose.Schema(
    "wannaBuyComments",
    wannaBuyCommentsSchema
);
// 导出求购商品留言集合
module.exports = wannaBuyComments;